package com.yusheng.exceptions;


import com.yusheng.constant.EmojiConstants;
import com.yusheng.constant.HttpStatus;

/**
 * @author Remy
 * @ClassName ExceptionEnum.java
 * @Description 异常处理枚举类
 * @createTime 2022年11月03日 12:17
 */
public enum ExceptionEnum implements BaseErrorInfoInterface {

    // 数据操作错误定义
    SUCCESS(HttpStatus.SUCCESS, "成功!"),
    PARAM_ERROR(300, "参数错误"),
    DATA_EMPTY(301, "数据不存在，请核实数据是否无误"),

    NOT_DELETE(302, "该数据不能删除"),

    NOT_USER_ID_ERROR(HttpStatus.NOT_LOGIN, "获取用户ID异常"),
    NOT_DEPT_ID_ERROR(HttpStatus.NOT_LOGIN, "获取部门ID异常"),
    NOT_USER_ACCOUNT_ERROR(HttpStatus.NOT_LOGIN, "获取用户账户异常"),
    NOT_USER_INFO_ERROR(HttpStatus.NOT_LOGIN, "获取用户信息异常"),
    NOT_STATUS_ERROR(HttpStatus.UNAUTHORIZED, "已停用，不支持该操作！"),
    DATA_UP(201, "数据已存在，请勿重复添加"),
    OSS_ERROR(500, "上传失败"+ EmojiConstants.grinning+"!"),

    OLD_SUCCESS(202, "操作已成功，请勿重复操作"),
    NOT_PRE_ALLOW(400, "没有访问权限!"),
    NOT_TOKEN(HttpStatus.NOT_LOGIN, "请重新登录"+ EmojiConstants.grinning+"!"),
    FEIGN_ERROR(505, "FEIGN错误"),

    FILE_ERROR(501, "文件过大！请限制在1M以内"),

    NULL_ERROR(502, "空指针异常，请核实数据是否无误"),
    BODY_NOT_MATCH(303, "请求的数据格式不符!"),
    SIGNATURE_NOT_MATCH(101, "请求的数字签名不匹配!"),
    MSG_403(403, "拒绝请求!"),
    NOT_FOUND(404, "未找到该资源!"),
    BAD_METHOD(405, "不允许的http方法"),
    INTERNAL_SERVER_ERROR(503, "服务器内部错误!"),
    SERVER_BUSY(504, "服务器正忙，请稍后再试!");

    /**
     * 错误码
     */
    private final Integer code;

    /**
     * 错误描述
     */
    private final String msg;

    ExceptionEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
